#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+5;
int n, cnt;
int a[MAXN];
bool vis[MAXN];
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin >> n;
	cnt = n;
	for (int i = 1; i <= n; i ++){
		cin >> a[i];
	}
	a[0] = -1;
	int i = 1, last = 0;
	while (cnt){
		if (i >= n){
			i = 1;
			last = 0;
			cout << endl;
		}
		int last2 = last;
		bool flag = 0;
		for (i = last2+1; i <= n; i ++){
			if (vis[i]) continue;
			if (a[last] != a[i]){
				flag = 1;
				break;
			} else last = i;
		}
		if (flag){
			cout << i << ' ';
			vis[i] = 1;
			cnt --;
			last = i;
		}
	}
	return 0;
} 
